package com.ruoyi.project.data.dataManager.controller;

import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.data.dataManager.domain.DataParamVo;
import com.ruoyi.project.data.dataManager.service.IDataManagerService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 数据导入配置Controller
 *
 * @author 魏刚
 * @date 2020-03-16
 */
@Controller
@RequestMapping("/data/stopTimer")
public class StopTimerController extends BaseController
{
    private String prefix = "data/dataManager";

    @Autowired
    private IDataManagerService dataManagerServiceImpl;

    @RequiresPermissions("data:stopTimer:view")
    @GetMapping()
    public String stopTimer()
    {
        return prefix + "/stopTimer";
    }

    /**
     * 查询数据导入配置列表
     */
    @RequiresPermissions("data:stopTimer:stop")
    @PostMapping("/stop")
    @Log(title = "停止定时器", businessType = BusinessType.OTHER)
    @ResponseBody
    public AjaxResult stop(DataParamVo vo) throws Exception {
        return toAjax(dataManagerServiceImpl.start(vo));
    }
}
